﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;

namespace Interface.Mvc.Areas.Utility.Controllers
{
    public class TestController : Controller
    {
        public string IP()
        {
            StringBuilder sb = new StringBuilder();

            foreach (var item in Request.Headers.AllKeys)
            {
                sb.AppendLine(item + ":" + Request.Headers[item]);
            }

            sb.AppendLine("<br />");
            sb.AppendLine("----------------------------------------------------------------");
            sb.AppendLine("<br />");

            foreach (var item in Request.ServerVariables.AllKeys)
            {
                sb.AppendLine(item + ":" + Request.ServerVariables[item]);
            }

            sb.AppendLine("<br />");
            sb.AppendLine("----------------------------------------------------------------");
            sb.AppendLine("<br />");

            sb.AppendLine(DateTime.Now.ToString());
            sb.AppendLine("REMOTE_ADDR:" + Request.ServerVariables["REMOTE_ADDR"]);
            sb.AppendLine("REMOTE_HOST:" + Request.ServerVariables["REMOTE_HOST"]);

            return sb.ToString();
        }
    }
}
